var setting = require( './models/setting' );

var settings = {
    'app.static.root': './'
};

var init = async function() {

    var data = await setting.getAll();

    if ( data ) {
        for ( var i = 0; i < data.length; i++ ) {
            settings[ data[ i ].key ] = data[ i ].value;
        }
    }
}

function getSetting( key ) {
    return settings[ key ];
}

exports.init = init;
exports.getSetting = getSetting;
